package br.inf.solutions.apresentacoes.ssp.model.hierarchy;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import br.com.vexillum.model.CommonEntityActivated;
import br.com.vexillum.model.annotations.NotInitialize;
import br.com.vexillum.model.annotations.Validate;
import br.inf.solutions.apresentacoes.ssp.model.enums.HierarchyStructColor;

@SuppressWarnings("serial")
@Entity
@Table(name="hierarchy_type")
public class HierarchyStructType extends CommonEntityActivated{
	
	@Column(nullable=false)
	private Integer level;
	
	@Column(nullable=false)
	private HierarchyStructColor color;
	
	@NotInitialize
	@OneToMany(fetch=FetchType.LAZY,mappedBy="type", targetEntity=HierarchyClassification.class)
	private List<HierarchyClassification> classifications;
	
	@Validate(notNull=true)
	@Column(nullable=false)
	private String name;
	
	public Integer getLevel() {
		return level;
	}
	public HierarchyStructColor getColor() {
		return color;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
	public void setColor(HierarchyStructColor color) {
		this.color = color;
	}
	public String getStyleClass() {
		return color.getStyleClass();
	}
	public List<HierarchyClassification> getClassifications() {
		return classifications;
	}
	public void setClassifications(List<HierarchyClassification> classifications) {
		this.classifications = classifications;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@Override
	public String toString() {
		return getName();
	}

}
